/**Copyright 2007 Ultrapower Software Co. Ltd.
 * All right reserved. 
 *
 * 2007-8-1,下午05:36:59
 */
package com.osgix.common.pojo.temp;

import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;

/**
 * <b>权限点动态分组方案</b>
 *
 * <b>@author zqmao 2007-8-1,下午05:36:59</b>
 *
 * <b>version 1.0</b>
 */
public class PpGroup implements Serializable {
	/**
	 * 2009-4-29,下午03:38:40
	 * @author Administrator
	 * @version 2.0
	 *
	 */
	private static final long serialVersionUID = -1598878648517564913L;

	/**
	 * 分组方案ID
	 */
	private String id = "";

	/**
	 * 分组方案名
	 */
	private String name = "";

	/**
	 * 分组方案属性，接照优先次序排序，所以使用TreeMap<Integer,PropertyType>
	 */
	private Map propertyMap = new TreeMap();

	/**
	 * 构造函数
	 *
	 */
	public PpGroup() {

	}

	/**
	 * 构造函数
	 * @param id
	 * @param name
	 */
	public PpGroup(String id, String name) {
		this.id = id;
		this.name = name;
	}

	/**
	 * 克隆方法
	 */
	public Object clone() {
		PpGroup newGroup = new PpGroup(id, name);
		Iterator iter = propertyMap.keySet().iterator();
		while (iter.hasNext()) {
			Integer index = (Integer) iter.next();
			newGroup.putPropertyType(index.intValue(), (PropertyType) propertyMap.get(index));
		}
		return newGroup;
	}

	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return name;
	}

	/**
	 * 添加一个属性类型
	 * @param index
	 * @param pro
	 */
	public void putPropertyType(int index, PropertyType pro) {
		propertyMap.put(new Integer(index), pro);
	}

	/**
	 * 返回指定序号的属性类型对象
	 * @param index
	 * @return
	 */
	public PropertyType getProperty(int index) {
		return (PropertyType) propertyMap.get(new Integer(index));
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Map getPropertyMap() {
		return propertyMap;
	}

	public void setPropertyMap(Map propertyMap) {
		this.propertyMap = propertyMap;
	}
}
